#include"mystdio.h"
#include<unistd.h>

int main()
{
  const char* filename="log.txt";
  myFILE* fp=myfopen(filename,"a");
  if(fp==NULL)
  {
    printf("myfopen error!\n");
    return 0;
  }

  const char* msg="hello linux";
  //const char* msg="hello linux\n";
  int cnt=10;
  while(cnt--)
  {
    myfputs(msg,fp);
    sleep(1);
    printf("debug: outbuffer = %s,pos = %d\n",fp->buffer,fp->pos);
  }
  myfclose(fp);

  printf("write file done!\n");

  return 0;
}
